Procédure de mise en place du script sur Outlook

Activez l’onglet Développeur : Fichier > Options > Personnaliser le ruban > Cocher "Développeur"

Depuis l’onglet développeur, activer toutes les macros : Paramètre des macros > Activer toutes les macros

Depuis l’onglet développeur, Visual Basic : Onglet ThisOutlookSession > Copier le code script.vba > Sauvegarder

Configuration du script : 

'==========================================================
' SCRIPT : Alerte destinataires externes / autre service
' VERSION : 2.0 - Stable
'==========================================================

Option Explicit

Const MON_DOMAINE As String = "@xxx.xx"  <-- modifier cette ligne avec votre nom de domaine

Const GROUPE_MON_SERVICE As String = "xx" <-- modifier cette ligne avec votre nom de votre OU dans l'AD (si vous avez plusieurs service sur le même AD)

'==========================================================
' FONCTION : Vérifie si une adresse est en liste blanche
'==========================================================
Private Function IsWhitelisted(strAddress As String) As Boolean

    IsWhitelisted = False

    Dim strList As String
    strList = "xxx-*|xxx-*"  <-- Modifier cette ligne avec vos adresses a mettre en liste blanche. Les adresse doivent être séparés par |

    Dim arrWhitelist()  As String
    Dim strEntry        As String
    Dim strPrefixe      As String
    Dim i               As Integer

    arrWhitelist = Split(strList, "|")
    strAddress = LCase(Trim(strAddress))

    For i = 0 To UBound(arrWhitelist)
        strEntry = LCase(Trim(arrWhitelist(i)))

        If Left(strEntry, 1) = "@" Then
            If InStr(strAddress, strEntry) > 0 Then
                IsWhitelisted = True
                Exit Function
            End If
        ElseIf Right(strEntry, 1) = "*" Then
            strPrefixe = Left(strEntry, Len(strEntry) - 1)
            If Left(strAddress, Len(strPrefixe)) = strPrefixe Then
                IsWhitelisted = True
                Exit Function
            End If
        Else
            If strAddress = strEntry Then
                IsWhitelisted = True
                Exit Function
            End If
        End If

    Next i